.container {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-bottom: 60px;
  padding: 0;
}

.main-content {
  padding-bottom: 60px;
}

.preview-active {
  padding-bottom: 280px;
}

.preview {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  margin: 0;
  padding: 10px;
  border-radius: 0;
  background-color: var(--bg-main);
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
  z-index: 99;



  .preview-cards {
    display: block;
    overflow-x: auto;
    overflow-y: hidden;
    width: 100%;
    white-space: nowrap;
    height: 135px;
  }

  .preview-card {
    width: 90px;
    /* 600/838比例换算 */
    height: 125.7px;
    /* 90 * (838/600) = 125.7 */
    border: 3px solid #eee;
    border-radius: 8px;
    display: inline-block;
    margin-right: 0.25rem;
    position: relative;
    overflow: hidden;

    &.selected {
      border-color: #eb445a;
    }
  }

  .action-buttons {
    margin-top: 15px;
    padding-bottom: constant(safe-area-inset-bottom);
    /* iOS 11.0 */
    padding-bottom: env(safe-area-inset-bottom);
    /* iOS 11.2+ */

    .button-list {
      display: flex;
      justify-content: center;
    }

    .button-placeholder {
      padding: 8px 16px;
      background-color: #f8f9fa;
      border: 1px dashed #dee2e6;
      border-radius: 4px;
      color: #6c757d;
      font-size: 12px;
    }
  }

  .header {
    padding-bottom: 10px;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
  }

  .close-button {
    position: absolute;
    top: -5px;
    right: 0;
    z-index: 1;
  }

}

/* 手牌确认弹窗样式 */
.hand-confirm-modal {
  width: 600rpx;
  padding: 20px;
  background-color: #fff;
  border-radius: 10px;

  .modal-title {
    font-size: 18px;
    font-weight: bold;
    text-align: center;
    margin-bottom: 15px;
  }

  .hand-cards {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 5rpx;
    margin-bottom: 20px;

    .hand-card {
      width: 180rpx;
      height: 251.1rpx;
      /* 180 * (209.25/150) = 251.1 */
      border-radius: 5px;
      overflow: hidden;
      margin: 5rpx;

      .card-image {
        display: inline-flex;
        width: 100%;
        height: 100%;
        box-sizing: border-box;
      }
    }
  }

  .modal-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
  }
}

.footer-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 8px;
  display: flex;
  justify-content: space-evenly;
  padding-bottom: calc(constant(safe-area-inset-bottom) + 8px);
  /* iOS 11.0 */
  padding-bottom: calc(env(safe-area-inset-bottom) + 8px);
  /* iOS 11.2+ */
  background-color: #fff;
  border-top: 1px solid #eee;
  box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.1);
  z-index: 100;
}

.popup-card-detail {
  --td-popup-bg-color: rgba(255, 255, 255, 0);
}

.player-battlefield {
  margin: 10px;
  padding: 10px;
  border: 1px solid #eee;
  border-radius: 5px;
}

.battle-row {
  display: flex;
  justify-content: center;
  margin-bottom: 30px;
  position: relative;
}

.area-slot {
  box-sizing: border-box;
  width: 120rpx;
  /* 750rpx / 6 = 125rpx，留5rpx作为间隙 */
  height: 167.4rpx;
  /* 120 * (837/600) = 167.4 */
  margin: 0 1rpx;
  /* 总间隙5rpx */
  border: 2px solid #ddd;
  border-radius: 5px;
  position: relative;
  transition: all 0.2s;

  &.selected {
    border: 2px solid #eb445a;
  }

  .area-name {
    position: absolute;
    bottom: -25px;
    left: 0;
    right: 0;
    text-align: center;
    background-color: transparent;
    color: #333;
    font-size: 12px;
    padding: 5px 0;
    padding: 2px 0;
  }

}

.regular-area-slot {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  flex-direction: row;
  width: 360rpx;
  height: 168rpx;

  .function {
    display: block;
    box-sizing: border-box;
    height: 100%;
    width: 50%;
    padding: 2rpx;

    .content {
      font-size: 0.9em;
      display: flex;
      justify-content: center;
      align-items: center;
      flex-direction: column;
      border: none;
      height: 100%;
      width: 100%;
      color: white;
      text-align: center;
      background: linear-gradient(to bottom, #999, #333);
    }

    .content.danger {
      background: linear-gradient(to bottom, #d8808c, #eb445a);
    }

    .content.warning {
      background: linear-gradient(to bottom, #ffc409, #bb9108);
    }

    .content.success {
      background: linear-gradient(to bottom, #1fa053, #2dd36f);
    }
  }
}


.card-container {
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;

  .empty-area {
    width: 100%;
    height: 100%;
    background-color: #f0f0f0;
    border-radius: 4px;
  }

  .card-image {
    display: block;
    width: 100%;
    height: auto;
  }
}

.card-count {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 1.5em;
  color: #fff;
  background-color: rgba(0, 0, 0, 0.5);
}

.card-status {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 20px;
  display: flex;
  justify-content: center;
  align-items: center;
  color: #000;
  background: rgba($color: #ffc409, $alpha: 0.6);
}

.card-status.active {
  background: rgba($color: #2dd36f, $alpha: 0.6);
}

.rotated {
  transform: rotate(180deg);

  .area-name {
    transform: rotate(180deg);
    bottom: unset;
    top: -25px;
  }

  .card-status {
    transform: rotate(180deg);
    bottom: unset;
    top: 0;
  }

  .card-count {
    transform: rotate(180deg);
  }

  .card-actions {
    transform: rotate(180deg);
  }
}

.battle-area-separator {
  text-align: center;
  display: flex;
  justify-content: space-evenly;
  align-items: center;

  .separator-line {
    display: inline-flex;
  }
}